
<%@ page import="net.comic.entities.Comic" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="comic.create" default="Create Comic" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home" /></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="comic.list" default="Comic List" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="comic.create" default="Create Comic" /></h1>
            <g:if test="${flash.message}">
            	<div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
            </g:if>
            <g:hasErrors bean="${comicInstance}">
            	<div class="errors"><g:renderErrors bean="${comicInstance}" as="list" /></div>
            </g:hasErrors>
            <g:form action="save" method="post" enctype="multipart/form-data">
				<table>
                    <tr>
                        <td><label><g:message code="comic.name" default="Name" />:</label></td>
                        <td class="value ${hasErrors(bean: comicInstance, field: 'name', 'errors')}">
                            <g:textField name="name" maxlength="50" value="${fieldValue(bean: comicInstance, field: 'name')}" />
                        </td>
                    </tr>
                
                    <tr>
                        <td><label><g:message code="comic.description" default="Description" />:</label></td>
                        <td class="value ${hasErrors(bean: comicInstance, field: 'description', 'errors')}">
                            <g:textArea name="description" rows="5" cols="40" value="${fieldValue(bean: comicInstance, field: 'description')}" />
                        </td>
                    </tr>
                
                    <tr>
                        <td><label><g:message code="comic.author" default="Author" />:</label></td>
                        <td class="value ${hasErrors(bean: comicInstance, field: 'author', 'errors')}">
                            <g:select name="author.id" from="${net.comic.entities.Author.list()}" optionKey="id" value="${comicInstance?.author?.id}" noSelection="['null': '']" />
                        </td>
                    </tr>
                
                    <tr>
                        <td><label><g:message code="comic.imagePath" default="Image Path" />:</label></td>
                        <td class="value ${hasErrors(bean: comicInstance, field: 'imagePath', 'errors')}">
                        	<input type="file" name="file"/>
                        </td>
                    </tr>
               	</table>
               	
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'create', 'default': 'Create')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
